﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class ZhaoLuZhiWeiModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private string _DutyDes;
        [DataMember]
        public string DutyDes
        {
            get { return _DutyDes; }
            set { _DutyDes = value; }
        }
        /// <summary>
        /// 用于日程安排时
        /// </summary>
        private bool isselected1 = false;
        [DataMember]
        public bool IsSelected1
        {
            get { return isselected1; }
            set { isselected1 = value; }
        }
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }

        private string _Department;
        [DataMember]
        public string Department
        {
            get { return _Department; }
            set { _Department = value; }
        }

        private string _Duty;
        [DataMember]
        public string Duty
        {
            get { return _Duty; }
            set { _Duty = value; }
        }

        private string _DutyDescription;
        [DataMember]
        public string DutyDescription
        {
            get { return _DutyDescription; }
            set { _DutyDescription = value; }
        }

        private int _PeopleCount;
        [DataMember]
        public int PeopleCount
        {
            get { return _PeopleCount; }
            set { _PeopleCount = value; }
        }

        private string _BenKeZhuanYe;
        [DataMember]
        public string BenKeZhuanYe
        {
            get { return _BenKeZhuanYe; }
            set { _BenKeZhuanYe = value; }
        }

        private string _YanJiuShengZhuanYe;
        [DataMember]
        public string YanJiuShengZhuanYe
        {
            get { return _YanJiuShengZhuanYe; }
            set { _YanJiuShengZhuanYe = value; }
        }

        private string _Political;
        [DataMember]
        public string Political
        {
            get { return _Political; }
            set { _Political = value; }
        }

        private string _JCGZZDNX;
        [DataMember]
        public string JCGZZDNX
        {
            get { return _JCGZZDNX; }
            set { _JCGZZDNX = value; }
        }

        private string _Memo;
        [DataMember]
        public string Memo
        {
            get { return _Memo; }
            set { _Memo = value; }
        }

        private int _Status;
        [DataMember]
        public int Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _CheckMemo;
        [DataMember]
        public string CheckMemo
        {
            get { return _CheckMemo; }
            set { _CheckMemo = value; }
        }

        private string _ZKDX;
        [DataMember]
        public string ZKDX
        {
            get { return _ZKDX; }
            set { _ZKDX = value; }
        }

        private string _XueLiYaoQiu;
        [DataMember]
        public string XueLiYaoQiu
        {
            get { return _XueLiYaoQiu; }
            set { _XueLiYaoQiu = value; }
        }
        private string _XueWeiYaoQiu;
        [DataMember]
        public string XueWeiYaoQiu
        {
            get { return _XueWeiYaoQiu; }
            set { _XueWeiYaoQiu = value; }
        }

        private string _ZYKSKM;
        [DataMember]
        public string ZYKSKM
        {
            get { return _ZYKSKM; }
            set { _ZYKSKM = value; }
        }

        private string _StatusString;
        [DataMember]
        public string StatusString
        {
            get { return _StatusString; }
            set { _StatusString = value; }
        }

        private string _OrgName;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }

        private bool isselected = false;
        [DataMember]
        public bool IsSelected
        {
            get { return isselected; }
            set { isselected = value; }
        }

        private string _Other;
        [DataMember]
        public string Other
        {
            get { return _Other; }
            set { _Other = value; }
        }

        private int _Year;
        [DataMember]
        public int Year
        {
            get { return _Year; }
            set { _Year = value; }
        }

        private bool _IsLocked;
        [DataMember]
        public bool IsLocked
        {
            get { return _IsLocked; }
            set { _IsLocked = value; }
        }

        /// <summary>
        /// 科室
        /// </summary>
        private string _Department_Duty;
        [DataMember]
        public string Department_Duty
        {
            get { return _Department_Duty; }
            set { _Department_Duty = value; }
        }

        private string _ZhiWeiDaiMa;
        [DataMember]
        public string ZhiWeiDaiMa
        {
            get { return _ZhiWeiDaiMa; }
            set { _ZhiWeiDaiMa = value; }
        }
        public static ZhaoLuZhiWeiModel FillEntity(DataRow dr)
        {
            ZhaoLuZhiWeiModel right = new ZhaoLuZhiWeiModel();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) right.Sec = Convert.ToInt32(dr["Sec"]);
            right.ID = (int)dr["ID"];
            right.OrgID = (int)dr["OrgID"];
            right.Department = dr["Department"] as string;
            right.Duty = dr["Duty"] as string;
            right.DutyDescription = dr["DutyDescription"] as string;
            if (!string.IsNullOrEmpty(dr["PeopleCount"].ToString())) right.PeopleCount = Convert.ToInt32(dr["PeopleCount"]);
            right.JCGZZDNX = dr["JCGZZDNX"] as string;
            right.ZKDX = dr["ZKDX"] as string;

            right.BenKeZhuanYe = dr["BenKeZhuanYe"] as string;
            right.YanJiuShengZhuanYe = dr["YanJiuShengZhuanYe"] as string;
            right.Status = Convert.ToInt32(dr["Status"]);
            right.XueLiYaoQiu = dr["XueLiYaoQiu"] as string;
            right.XueWeiYaoQiu = dr["XueWeiYaoQiu"] as string;
            right.Political = dr["Political"] as string;
            right.ZYKSKM = dr["ZYKSKM"] as string;
            right.Other = dr["Other"] as string;
            right.Memo = dr["Memo"] as string;
            right.CheckMemo = dr["CheckMemo"] as string;
            right.ZhiWeiDaiMa = dr["ZhiWeiDaiMa"] as string;
            right.OrgName = dr["OrgName"] as string;
            right.Year = (int)dr["Year"];
            right.IsLocked = Convert.ToBoolean(dr["IsLocked"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Department_Duty"))
                right.Department_Duty = dr["Department_Duty"] as string;
            switch (right.Status)
            {
                case 0:
                    right.StatusString = "未提交";
                    break;
                case 1:
                    right.StatusString = "已提交";
                    break;
                case 2:
                    right.StatusString = "已退回";
                    break;
                case 3:
                    right.StatusString = "已审核";
                    break;
                case 4:
                    right.StatusString = "已发布";
                    break;
            }

            return right;
        }

    }
}
